var Ajax;
if (Ajax && (Ajax != null)) {
	Ajax.Responders.register({
	  onCreate: function() {
        if($('spinner') && Ajax.activeRequestCount>0)
          Effect.Appear('spinner',{duration:0.5,queue:'end'});
	  },
	  onComplete: function() {
        if($('spinner') && Ajax.activeRequestCount==0)
          Effect.Fade('spinner',{duration:0.5,queue:'end'});
	  }
	});
}

$(document).ready(function(){

  if(!NiftyCheck()) {
    return;
  } else { 
    Rounded("div#module1", "#fff", "#FF9900" ); 
    Rounded("div#module2", "#fff", "#FF9900" ); 
 	  Rounded("div#module3", "#fff", "#FF9900" ); 
    Rounded("div#module4", "#fff", "#FF9900" ); 
    Rounded("div#module5", "#fff", "#FF9900" ); 
    Rounded("div#maincontent", "#fff", "#3973C5" );     
    
    RoundedBottom("div#site_info", "#fff", "#DEE89A" );     
    
  }


  $("#paragraphs").hide();
  $('#loading').hide();
  $('#ajax-content').hide();
  $('#section-menu2').hide();
  $('#section-menu3').hide();
  $('#section-menu4').hide();
  $('#section-menu5').hide();

  $('.kwicks').kwicks({  
    max : 485  
  });  

  $("#toggle-ajax").click(function(event){  
    if ($('#toggle-ajax').hasClass('hidden')) { // checks if the content is visible
      $('#loading').show();
      $("#ajax-content").load("ajax-response.html");
      $('#loading').hide();
    } else { 
    }
    
    return false;
	});

  $(".hidden,.visible").click(function(event){  
    if ($(this).hasClass('hidden')){
      $(this).removeClass('hidden')
      $(this).addClass('visible');
    } else {
      $(this).removeClass('visible')
      $(this).addClass('hidden');
    }
    $(this).parent().next().slideToggle();
    
    return false;
  });

	$("#accordion dd:not(:first)").hide();
	$("#accordion dt").click(function(){
		$("#accordion dd:visible").slideUp("slow");
		$(this).next().slideDown("slow");
		return false;
	});

	$("#section-menu dd:not(:first)").hide();
	$("#section-menu dt").click(function(){
		$("#section-menu dd:visible").slideUp("slow");
		$(this).next().slideDown("slow");
		return false;
	});


});   
